import os
import json
from datetime import datetime

def create_sample_products(product_dir="./zh_data/products"):
    """
    创建示例商品数据
    
    参数:
        product_dir: 商品目录
    """
    # 确保目录存在
    os.makedirs(product_dir, exist_ok=True)
    
    # 零食样本数据
    snacks = [
        {
            "id": "snack001",
            "name": "乐事薯片原味",
            "category": "零食",
            "price": "8.9元",
            "description": "乐事薯片原味，采用优质马铃薯制作，口感酥脆，原味经典。每包净含量70g，适合休闲时光享用。"
        },
        {
            "id": "snack002",
            "name": "奥利奥夹心饼干",
            "category": "零食",
            "price": "12.5元",
            "description": "奥利奥经典夹心饼干，巧克力味，外酥内软，夹心香甜。每包净含量116g，独立小包装，方便携带。"
        },
        {
            "id": "snack003",
            "name": "三只松鼠每日坚果",
            "category": "零食",
            "price": "29.9元",
            "description": "三只松鼠每日坚果混合装，包含核桃、腰果、杏仁、开心果等多种坚果，营养丰富，每日一包，健康生活。"
        },
        {
            "id": "snack004",
            "name": "卫龙辣条",
            "category": "零食",
            "price": "5.5元",
            "description": "卫龙经典辣条，香辣可口，劲道十足。每包净含量106g，独立包装，方便食用。"
        },
        {
            "id": "snack005",
            "name": "旺旺雪饼",
            "category": "零食",
            "price": "15.8元",
            "description": "旺旺雪饼，香脆可口，奶香浓郁。每包净含量520g，适合全家分享。"
        }
    ]
    
    # 女装样本数据
    women_clothes = [
        {
            "id": "clothes001",
            "name": "ZARA 女士休闲衬衫",
            "category": "女装",
            "price": "299元",
            "description": "ZARA 女士休闲衬衫，采用优质棉质面料，舒适透气。简约设计，适合日常穿着。尺码从XS到XL都有，有多种颜色可选。"
        },
        {
            "id": "clothes002",
            "name": "优衣库女士牛仔裤",
            "category": "女装",
            "price": "199元",
            "description": "优衣库女士牛仔裤，采用弹力面料，穿着舒适。修身版型，显瘦效果。尺码从25到32都有，有深蓝、浅蓝两种颜色可选。"
        },
        {
            "id": "clothes003",
            "name": "H&M 女士连衣裙",
            "category": "女装",
            "price": "399元",
            "description": "H&M 女士连衣裙，采用轻盈面料，设计简约时尚。适合各种场合穿着，尺码从XS到L都有，有多种颜色和图案可选。"
        },
        {
            "id": "clothes004",
            "name": "太平鸟女士卫衣",
            "category": "女装",
            "price": "259元",
            "description": "太平鸟女士卫衣，采用优质棉质面料，舒适保暖。宽松版型，休闲百搭。尺码从S到XL都有，有多种颜色可选。"
        },
        {
            "id": "clothes005",
            "name": "ONLY 女士风衣",
            "category": "女装",
            "price": "899元",
            "description": "ONLY 女士风衣，采用防水面料，防风保暖。经典设计，适合春秋季节穿着。尺码从XS到XL都有，有卡其、黑色两种颜色可选。"
        },
        {
            "id": "clothes006",
            "name": "比基尼泳装三件套",
            "category": "女装",
            "price": "299元",
            "description": "时尚比基尼泳装三件套，包含上衣、下装和罩衫。采用速干面料，舒适透气，防紫外线。适合沙滩、泳池等场景。"
        },
        {
            "id": "clothes007",
            "name": "波西米亚风沙滩裙",
            "category": "女装",
            "price": "199元",
            "description": "波西米亚风格沙滩裙，轻盈飘逸，印花图案。V领设计，收腰剪裁，适合海边度假穿着。"
        }
    ]
    
    # 配饰样本数据
    accessories = [
        {
            "id": "accessory001",
            "name": "施华洛世奇水晶项链",
            "category": "配饰",
            "price": "1299元",
            "description": "施华洛世奇水晶项链，采用优质水晶，设计精美。适合各种场合佩戴，是送礼佳品。"
        },
        {
            "id": "accessory002",
            "name": "COACH 女士手提包",
            "category": "配饰",
            "price": "2999元",
            "description": "COACH 女士手提包，采用优质皮革，做工精细。容量适中，适合日常使用。有黑色、棕色两种颜色可选。"
        },
        {
            "id": "accessory003",
            "name": "卡西欧女士手表",
            "category": "配饰",
            "price": "899元",
            "description": "卡西欧女士手表，石英机芯，走时精准。防水设计，适合日常佩戴。有玫瑰金、银色两种颜色可选。"
        },
        {
            "id": "accessory004",
            "name": "雷朋太阳镜",
            "category": "配饰",
            "price": "1299元",
            "description": "雷朋经典款太阳镜，采用优质镜片，防紫外线。时尚设计，适合各种场合佩戴。有黑色、棕色两种颜色可选。"
        },
        {
            "id": "accessory005",
            "name": "潘多拉手链",
            "category": "配饰",
            "price": "999元",
            "description": "潘多拉手链，采用优质银饰，可自由搭配串珠。设计精美，适合日常佩戴。有多种串珠可选，可个性化定制。"
        },
        {
            "id": "accessory006",
            "name": "大檐遮阳草帽",
            "category": "配饰",
            "price": "159元",
            "description": "大檐遮阳草帽，采用天然草编材质，透气舒适。帽檐宽大，有效遮挡阳光，搭配丝带装饰，时尚百搭。"
        },
        {
            "id": "accessory007",
            "name": "沙滩拖鞋",
            "category": "配饰",
            "price": "89元",
            "description": "舒适沙滩拖鞋，EVA材质，防滑耐磨。轻便易穿，适合沙滩漫步。"
        },
        {
            "id": "accessory008",
            "name": "防晒披肩",
            "category": "配饰",
            "price": "129元",
            "description": "轻薄防晒披肩，UPF50+防晒指数。可做披肩、围巾、沙滩巾使用，多功能设计。"
        },
        {
            "id": "accessory009",
            "name": "沙滩包",
            "category": "配饰",
            "price": "169元",
            "description": "大容量沙滩包，防水材质，可折叠设计。内设多个口袋，方便收纳防晒霜、手机等物品。"
        },
        {
            "id": "accessory010",
            "name": "太阳镜",
            "category": "配饰",
            "price": "199元",
            "description": "时尚太阳镜，UV400防护，偏光镜片。适合海边度假，保护眼睛免受强光伤害。"
        }
    ]
    
    # 创建商品目录
    categories = ["零食", "女装", "配饰"]
    for category in categories:
        category_path = os.path.join(product_dir, category)
        os.makedirs(category_path, exist_ok=True)
    
    # 保存零食数据
    for snack in snacks:
        file_path = os.path.join(product_dir, "零食", f"{snack['id']}.json")
        with open(file_path, "w", encoding="utf-8") as f:
            json.dump(snack, f, ensure_ascii=False, indent=4)
        print(f"已创建零食商品: {snack['name']}")
    
    # 保存女装数据
    for clothes in women_clothes:
        file_path = os.path.join(product_dir, "女装", f"{clothes['id']}.json")
        with open(file_path, "w", encoding="utf-8") as f:
            json.dump(clothes, f, ensure_ascii=False, indent=4)
        print(f"已创建女装商品: {clothes['name']}")
    
    # 保存配饰数据
    for accessory in accessories:
        file_path = os.path.join(product_dir, "配饰", f"{accessory['id']}.json")
        with open(file_path, "w", encoding="utf-8") as f:
            json.dump(accessory, f, ensure_ascii=False, indent=4)
        print(f"已创建配饰商品: {accessory['name']}")

if __name__ == "__main__":
    create_sample_products() 